package com.hh.bss.mobile.controller;

import java.io.IOException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.servlet.ModelAndView;

import com.hh.bss.base.BaseSpringController;
import com.hh.bss.common.page.Page;
import com.hh.bss.customer.entity.Company;
import com.hh.bss.customer.service.CompanyService;
import com.hh.bss.customer.vo.query.CompanyQuery;
import com.hh.bss.talent.vo.query.CvQuery;

@Controller
public class CompanyController extends BaseSpringController  {
	private CompanyService companyService;
	public void setCompanyServiceImpl(CompanyService service) {
		this.companyService = service;
	}	
	public ModelAndView extlist(HttpServletRequest request, HttpServletResponse response,CompanyQuery companyQuery) throws IOException {
		Page page=companyService.findSimplePage(companyQuery);
		//query.getPageSize(), query.getPageNumber()
		ModelAndView mv = new ModelAndView();
		mv.setViewName("/mobile/company/companyPage");
		
		mv.addObject("pages", page);
		mv.addObject("query", companyQuery);
		response.setCharacterEncoding("UTF-8");
		return mv;
		
	}
	public ModelAndView companyDetail(HttpServletRequest request, HttpServletResponse response,Company company) throws IOException {		
		Company oldcompany = (Company)companyService.getById(company.getId());
		ModelAndView mv = new ModelAndView();
		mv.setViewName("/mobile/company/companyDetail");				
		mv.addObject("company", oldcompany);
		response.setCharacterEncoding("UTF-8");
		return mv;
		
	}
}
